I created package.swift for my framework. And was work correctly in iOS. Now we need to support tvOS. I don't understood how can we do it. Because source code is different but networking layer is same.
When I create dynamic targets:
extension Target{
static func allTargets() -> [Target]{
return ([
Target.SDKTarget(),
] as [[Target]]).flatMap{$0}
}
static func SDKTarget() -> [Target] {
#if os(tvOS)
return [
.target(name: frameworkName,
dependencies: [
.product(name: "GRPC", package: "grpc-swift"),
],
path: "Sources/tvOS",
)
]
#else
and when I select tvOS build this code in preprocessor block still gray and won't compile.
How to make single package.swift for my framework for support tvOS and iOS with different code base and shared networking source code?
Post
Replies
Boosts
Views
Activity
xcode 13.4 trying move from fat to xcframework.
I create the package by: 'swift package init --type library`;
Move our sources to Source folder;
Generate archive for iOS:
xcodebuild archive -scheme TestFramework \
-destination "generic/platform=iOS" \
-archivePath ./Archive-iOS \
-derivedDataPath ".build" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
. Generate archive for iOS Simulator:
xcodebuild archive -scheme TestFramework \
-destination "generic/platform=iOS Simulator" \
-archivePath ./Archive-iOSSimulator \
-derivedDataPath ".build" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
Generate the xcframework by docs:
xcodebuild -create-xcframework \
-framework './Archive-iOS.xcarchive/Products/Library/Frameworks/TestFramework.framework' \
-framework './Archive-iOSSimulator.xcarchive/Products/Library/Frameworks/TestFramework.framework' \
-output './Archive-iOS.xcarchive.xcframework'
got error:
error: unable to read the file -> ./Archive-iOS.xcarchive/Products/Library/Frameworks/TestFramework.framework/TestFramework
Ofc, because on steps 3,4 I haven't this framework in archive. Where can I found correct documentation with step by step for make xcframeworks?
SUBJ
Why after update iOS version, my app lost data in keychain?